/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import {HasProperty} from './hamcrest/beans/HasProperty.js'
import {CharSequenceLength} from './hamcrest/text/CharSequenceLength.js'
import {AnyOf} from './hamcrest/core/AnyOf.js'
import {IsBlankString} from './hamcrest/text/IsBlankString.js'
import {IsEqualIgnoringCase} from './hamcrest/text/IsEqualIgnoringCase.js'
import {StringContains} from './hamcrest/core/StringContains.js'
import {StringEndsWith} from './hamcrest/core/StringEndsWith.js'
import {StringStartsWith} from './hamcrest/core/StringStartsWith.js'
import {AllOf} from './hamcrest/core/AllOf.js'
import {IsEqual} from './hamcrest/core/IsEqual.js'
import {IsNaN} from './hamcrest/number/IsNaN.js'
import {OrderingComparison} from './hamcrest/number/OrderingComparison.js'
import {IsCloseTo} from './hamcrest/number/IsCloseTo.js'
import { IsNull } from './hamcrest/core/IsNull.js'
import {IsNot} from './hamcrest/core/IsNot.js'
import {Is} from './hamcrest/core/Is.js'
import {IsArray} from './hamcrest/collection/IsArray.js'
import {IsIn} from './hamcrest/collection/IsIn.js'
import {Every} from './hamcrest/core/Every.js'
import {MatchesPattern} from './hamcrest/text/MatchesPattern.js'
import {IsEqualCompressingWhiteSpace} from './hamcrest/text/IsEqualCompressingWhiteSpace.js'
import {IsSame} from './hamcrest/core/IsSame.js'
import {IsIterableContaining} from './hamcrest/core/IsIterableContaining.js'
import {IsEmptyString} from './hamcrest/text/IsEmptyString.js'
import {ArrayMatching} from './hamcrest/collection/ArrayMatching.js'
import {IsAnything} from './hamcrest/core/IsAnything.js'
import {IsInstanceOf} from './hamcrest/core/IsInstanceOf.js'



const runCount = 150000;
const runCount_short = 10000;

class Student {
    name;
    age;
    grade;
    sex;
    constructor(name,age, grade, sex) {
        this.name = name;
        this.age = age;
        this.grade = grade;
        this.sex = sex;
    }
}


/**
 * HasProperty
 * hasProperty
*/
function hasProperty_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = HasProperty.hasProperty('name')
    }
    let endTime = getDate()
    let stu = new Student('joe',12, 3, 1)
    let result = matcher.matches(stu)
    if (result !== true) {
        throw new Error('hamcrest_hasProperty error')
    }
    print(`hamcrest_hasProperty: ${endTime - startTime} ms`)
}

function hasProperty_Matches_Test() {
    let stu = new Student('joe',12, 3, 1)
    let matcher = HasProperty.hasProperty('name')
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(stu)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_hasProperty_matches error')
    }
    print(`hamcrest_hasProperty_matches: ${endTime - startTime} ms`)
}

/**
 * CharSequenceLength
 * hasLength
*/
function hasLength_Test() { 
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = CharSequenceLength.hasLength(103);
    }
    let endTime = getDate()
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_hasLength error')
    }
    print(`hamcrest_hasLength: ${endTime - startTime} ms`) 
}

function hasLength_Matches_Test() {
    let matcher = CharSequenceLength.hasLength(103);
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_hasLength_matches error')
    }
    print(`hamcrest_hasLength_matches: ${endTime - startTime} ms`) 
}

/**
 * AnyOf
 * anyOf
*/
function anyOf_Test() {
    let matcher
    let startWith = StringStartsWith.startsWith('Every')
    let contains = StringContains.containsString("bank")
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = AnyOf.anyOf([startWith, contains])
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_anyOf error')
    }
    print(`hamcrest_anyOf: ${endTime - startTime} ms`) 
}

function anyOf_Matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = AnyOf.anyOf([StringStartsWith.startsWith('Every'), StringContains.containsString("bank")]) 
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_anyOf_matches error')
    }
    print(`hamcrest_anyOf_matches: ${endTime - startTime} ms`) 
}

/**
 * AnyOf
 * anyOfMatches
*/
function anyOfMatches_Test() {
    let matcher
    let startWith = StringStartsWith.startsWith('Every')
    let contains = StringContains.containsString("bank")
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = AnyOf.anyOfMatches(startWith, contains)
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_anyOfMatches error')
    }
    print(`hamcrest_anyOfMatches: ${endTime - startTime} ms`) 
}

function anyOfMatches_Matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = AnyOf.anyOfMatches(StringStartsWith.startsWith('Every'), StringContains.containsString("bank")) 
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_anyOfMatches_matches error')
    }
    print(`hamcrest_anyOfMatches_matches: ${endTime - startTime} ms`) 
}


/**
 * StringContains
 * containsString
*/
function containsString_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringContains.containsString('walks')
    }
    let endTime = getDate()
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_containsString error')
    }
    print(`hamcrest_containsString: ${endTime - startTime} ms`)
}

function containsString_matches_Test() {
    let matcher = StringContains.containsString('SHe')
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_containsString_matches error')
    }
    print(`hamcrest_containsString_matches: ${endTime - startTime} ms`)
}

/**
 * StringContains
 * containsStringIgnoringCase
*/
function containsStringIgnoringCase_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringContains.containsStringIgnoringCase('WaLks')
    }
    let endTime = getDate()
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_containsStringIgnoringCase error')
    }
    print(`hamcrest_containsStringIgnoringCase: ${endTime - startTime} ms`)
}

function containsStringIgnoringCase_matches_Test() {
    let matcher = StringContains.containsStringIgnoringCase('She')
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_containsStringIgnoringCase_matches error')
    }
    print(`hamcrest_containsStringIgnoringCase_matches: ${endTime - startTime} ms`)
}

/**
 * AllOf
 * allOf
*/
function allOf_Test() {
    let matcher
    let startWith = StringStartsWith.startsWithIgnoringCase('every')
    let contains = StringContains.containsString('park')
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = AllOf.allOf([startWith, contains])
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_allOf error')
    }
    print(`hamcrest_allOf: ${endTime - startTime} ms`) 
}

function allOf_matches_Test() {
    let startWith = StringStartsWith.startsWithIgnoringCase('every')
    let contains = StringContains.containsString('park')
    let matcher = AllOf.allOf([startWith, contains])
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_allOf_matches error')
    }
    print(`hamcrest_allOf_matches: ${endTime - startTime} ms`) 
}

/**
 *  AllOf
 *  allOfMatches
*/
function allOfMatches_Test() {
    let matcher
    let startWith = StringStartsWith.startsWithIgnoringCase('every')
    let contains = StringContains.containsString('park')
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = AllOf.allOfMatches(startWith, contains)
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_allOfMatches error')
    }
    print(`hamcrest_allOfMatches: ${endTime - startTime} ms`) 
}

function allOfMatches_matches_Test() {
    let startWith = StringStartsWith.startsWithIgnoringCase('every')
    let contains = StringContains.containsString('park')
    let matcher = AllOf.allOfMatches(startWith, contains)
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_allOfMatches_matches error')
    }
    print(`hamcrest_allOfMatches_matches: ${endTime - startTime} ms`) 
}

/**
 * IsNaN
 * notANumber
*/
function notANumber_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsNaN.notANumber()
    }
    let endTime = getDate()
    let result = matcher.matches(Number.NaN)
    if (result !== true) {
        throw new Error('hamcrest_notANumber error')
    }
    print(`hamcrest_notANumber: ${endTime - startTime} ms`) 
}

function notANumber_matches_Test() {
    let matcher = IsNaN.notANumber()
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(7.5)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_notANumber_matches error')
    }
    print(`hamcrest_notANumber_matches: ${endTime - startTime} ms`) 
}

/**
 * IsEqual
 * equalTo
*/
function equalTo_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEqual.equalTo(arr)
    }
    let endTime = getDate()
    let arr1 = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result = matcher.matches(arr1)
    if (result !== true) {
        throw new Error('hamcrest_equalTo error')
    }
    print(`hamcrest_equalTo: ${endTime - startTime} ms`) 
}

function equalTo_matches_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let arr1 = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia"]
    let matcher = IsEqual.equalTo(arr)
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(arr1)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_equalTo_matches error')
    }
    print(`hamcrest_equalTo_matches: ${endTime - startTime} ms`) 
}


/**
 * IsEqualIgnoringCase
 * equalToIgnoringCase
*/
function equalToIgnoringCase_Test() {
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEqualIgnoringCase.equalToIgnoringCase(str)
    }
    let endTime = getDate()
    let str1 = 'EVERY MORNING, SHE WALKS THROUGH THE QUIET PARK, ENJOYING THE SERENE BEAUTY OF NATURE AS THE SUN RISES.'
    let result = matcher.matches(str1)
    if (result !== true) {
        throw new Error('hamcrest_equalToIgnoringCase error')
    }
    print(`hamcrest_equalToIgnoringCase: ${endTime - startTime} ms`) 
}

function equalToIgnoringCase_matches_Test() {
    let str = 'Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises.'
    let str1 = 'EVERY afternoon, SHE WALKS THROUGH THE QUIET PARK, ENJOYING THE SERENE BEAUTY OF NATURE AS THE SUN rises.'
    let matcher = IsEqualIgnoringCase.equalToIgnoringCase(str)
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str1)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_equalToIgnoringCase_matches error')
    }
    print(`hamcrest_equalToIgnoringCase_matches: ${endTime - startTime} ms`) 
}

/**
 * OrderingComparison
 * greaterThan
*/
function greaterThan_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = OrderingComparison.greaterThan(100)
    }
    let endTime = getDate()
    let result = matcher.matches(50)
    if (result !== false) {
        throw new Error('hamcrest_greaterThan error')
    }
    print(`hamcrest_greaterThan: ${endTime - startTime} ms`) 
}

function greaterThan_matches_Test() {
    let matcher = OrderingComparison.greaterThan(100)
    let result 
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(128)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_greaterThan_matches error')
    }
    print(`hamcrest_greaterThan_matches: ${endTime - startTime} ms`) 
}
 
/**
 * OrderingComparison
 * greaterThanOrEqualTo
*/
function greaterThanOrEqualTo_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = OrderingComparison.greaterThanOrEqualTo(100)
    }
    let endTime = getDate()
    let result = matcher.matches(100)
    if (result !== true) {
        throw new Error('hamcrest_greaterThanOrEqualTo error')
    }
    print(`hamcrest_greaterThanOrEqualTo: ${endTime - startTime} ms`) 
}


function greaterThanOrEqualTo_matches_Test() {
    let matcher = OrderingComparison.greaterThanOrEqualTo(100)
    let result 
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(99)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_greaterThanOrEqualTo_matches error')
    }
    print(`hamcrest_greaterThanOrEqualTo_matches: ${endTime - startTime} ms`) 
}




/**
 * OrderingComparison
 * lessThan
*/
function lessThan_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = OrderingComparison.lessThan(100)
    }
    let endTime = getDate()
    let result = matcher.matches(50)
    if (result !== true) {
        throw new Error('hamcrest_lessThan error')
    }
    print(`hamcrest_lessThan: ${endTime - startTime} ms`) 
}

function lessThan_matches_Test() {
    let matcher = OrderingComparison.lessThan(100)
    let result 
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(128)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_lessThan_matches error')
    }
    print(`hamcrest_lessThan_matches: ${endTime - startTime} ms`) 
}

/**
 * OrderingComparison
 * lessThanOrEqualTo
*/
function lessThanOrEqualTo_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = OrderingComparison.lessThanOrEqualTo(100)
    }
    let endTime = getDate()
    let result = matcher.matches(100)
    if (result !== true) {
        throw new Error('hamcrest_lessThanOrEqualTo error')
    }
    print(`hamcrest_lessThanOrEqualTo: ${endTime - startTime} ms`) 
}

function lessThanOrEqualTo_matches_Test() {
    let matcher = OrderingComparison.lessThanOrEqualTo(100)
    let result 
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(128)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_lessThanOrEqualTo_matches error')
    }
    print(`hamcrest_lessThanOrEqualTo_matches: ${endTime - startTime} ms`) 
}

/**
 * OrderingComparison
 * comparesEqualTo
*/
function comparesEqualTo_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = OrderingComparison.comparesEqualTo(100)
    }
    let endTime = getDate()
    let result = matcher.matches(100)
    if (result !== true) {
        throw new Error('hamcrest_comparesEqualTo error')
    }
    print(`hamcrest_comparesEqualTo: ${endTime - startTime} ms`) 
}

function comparesEqualTo_matches_Test() {
    let matcher = OrderingComparison.comparesEqualTo(100)
    let result 
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(50)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_comparesEqualTo_matches error')
    }
    print(`hamcrest_comparesEqualTo_matches: ${endTime - startTime} ms`) 
}

/**
 * IsBlankString
 * blankString
*/
function blankString_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsBlankString.blankString();
    }
    let endTime = getDate()
    let result = matcher.matches('ap ple')
    if (result !== true) {
        throw new Error('hamcrest_blankString error')
    }
    print(`hamcrest_blankString: ${endTime - startTime} ms`)
}

function blankString_matches_Test() {
    let matcher = IsBlankString.blankString();
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches('apple')
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_blankString_matches error')
    }
    print(`hamcrest_blankString_matches: ${endTime - startTime} ms`)
}




/**
 * IsBlankString
 * blankOrNullString
*/
function blankOrNullString_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsBlankString.blankOrNullString();
    }
    let endTime = getDate()
    let result = matcher.matches('ap ple')
    if (result !== true) {
        throw new Error('hamcrest_blankOrNullString error')
    }
    print(`hamcrest_blankOrNullString: ${endTime - startTime} ms`)
}

function blankOrNullString_matches_Test() {
    let matcher = IsBlankString.blankOrNullString();
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(null)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_blankOrNullString_matches error')
    }
    print(`hamcrest_blankOrNullString_matches: ${endTime - startTime} ms`)
}


/**
 * IsCloseTo
 * closeTo
*/

function closeTo_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsCloseTo.closeTo(100, 10);
    }
    let endTime = getDate()
    let result = matcher.matches(110)
    if (result !== true) {
        throw new Error('hamcrest_closeTo error')
    }
    print(`hamcrest_closeTo: ${endTime - startTime} ms`)
}

function closeTo_matches_Test() {
    let matcher = IsCloseTo.closeTo(100, 10.5);
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(115)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_closeTo_matches error')
    }
    print(`hamcrest_closeTo_matches: ${endTime - startTime} ms`)
}


/**
 * IsNull
 * nullValue
*/
function nullValue_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsNull.nullValue() 
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== false) {
        throw new Error('hamcrest_nullValue error')
    }
    print(`hamcrest_nullValue: ${endTime - startTime} ms`)
}

function nullValue_matches_Test() {
    let matcher = IsNull.nullValue() 
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_nullValue_matches error')
    }
    print(`hamcrest_nullValue_matches: ${endTime - startTime} ms`)
}

/**
 * IsNull
 * notNullValue
*/
function notNullValue_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsNull.notNullValue() 
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_notNullValue error')
    }
    print(`hamcrest_notNullValue: ${endTime - startTime} ms`)
}

function notNullValue_matches_Test() {
    let matcher = IsNull.notNullValue() 
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_notNullValue_matches error')
    }
    print(`hamcrest_notNullValue_matches: ${endTime - startTime} ms`)
}

/**
 * IsNot
 * not
 */

function not_Test() {
    let contains = StringContains.containsString('beauty')
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsNot.not(contains);
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== false) {
        throw new Error('hamcrest_not error')
    }
    print(`hamcrest_not: ${endTime - startTime} ms`)
}

function not_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let contains = StringContains.containsString('She')
    let matcher = IsNot.not(contains);
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_not_matches error')
    }
    print(`hamcrest_not_matches: ${endTime - startTime} ms`)
}

/**
 * Is
 * is
*/
function is_Test() {
    let startWith = StringStartsWith.startsWith('Every')
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = Is.is(startWith);
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_is error')
    }
    print(`hamcrest_is: ${endTime - startTime} ms`)
}

function is_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let contains = StringContains.containsStringIgnoringCase('She')
    let matcher = Is.is(contains);
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_is_matches error')
    }
    print(`hamcrest_is_matches: ${endTime - startTime} ms`)
}

/**
 * StringStartsWith
 * startsWith
*/

function startsWith_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringStartsWith.startsWith('Every morning')
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_startsWith error')
    }
    print(`hamcrest_startsWith: ${endTime - startTime} ms`)
}

function startsWith_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = StringStartsWith.startsWith('enjoying')
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_startsWith_matches error')
    }
    print(`hamcrest_startsWith_matches: ${endTime - startTime} ms`)
}

/**
 * StringStartsWith
 * startsWithIgnoringCase
*/
function startsWithIgnoringCase_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringStartsWith.startsWithIgnoringCase('EVERY Morning')
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_startsWithIgnoringCase error')
    }
    print(`hamcrest_startsWithIgnoringCase: ${endTime - startTime} ms`)
}

function startsWithIgnoringCase_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = StringStartsWith.startsWithIgnoringCase('Enjoying')
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_startsWithIgnoringCase_matches error')
    }
    print(`hamcrest_startsWithIgnoringCase_matches: ${endTime - startTime} ms`)
}

/**
 * StringEndsWith
 * endsWith
*/

function endsWith_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringEndsWith.endsWith('sun rises.')
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_endsWith error')
    }
    print(`hamcrest_endsWith: ${endTime - startTime} ms`)
}

function endsWith_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = StringEndsWith.endsWith('park')
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_endsWith_matches error')
    }
    print(`hamcrest_endsWith_matches: ${endTime - startTime} ms`)
}

/***
 * StringEndsWith
 * endsWithIgnoringCase
 */
function endsWithIgnoringCase_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = StringEndsWith.endsWithIgnoringCase('Sun Rises.')
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_endsWithIgnoringCase error')
    }
    print(`hamcrest_endsWithIgnoringCase: ${endTime - startTime} ms`)
}

function endsWithIgnoringCase_matches_Test() {
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let matcher = StringEndsWith.endsWithIgnoringCase('Sun Rises.')
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str)
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_endsWithIgnoringCase_matches error')
    }
    print(`hamcrest_endsWithIgnoringCase_matches: ${endTime - startTime} ms`)
}

/**
 * IsArray
 * array
*/

function array_Test() {
    let equalA = IsEqual.equalTo('a')
    let equalB = IsEqual.equalTo('b')
    let equalC = IsEqual.equalTo('c')
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsArray.array(equalA, equalB,equalC)                                                             
    }
    let endTime = getDate()
    let result = matcher.matches(['a', 'c', 'b']) 
    if (result !== false) {
        throw new Error('hamcrest_array error')
    }
    print(`hamcrest_array: ${endTime - startTime} ms`)
}

function array_matches_Test() {
    let equalA = IsEqual.equalTo('a')
    let equalB = IsEqual.equalTo('b')
    let equalC = IsEqual.equalTo('c')
    let matcher = IsArray.array(equalA, equalB,equalC)  
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(['a', 'b', 'c'])                                                           
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_array_matches error')
    }
    print(`hamcrest_array_matches: ${endTime - startTime} ms`)
}

/**
 * IsIn
 * isIn
*/
function isIn_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsIn.isIn(arr)                                                                  
    }
    let endTime = getDate()
    let result = matcher.matches("David")
    if (result !== true) {
        throw new Error('hamcrest_isIn error')
    }
    print(`hamcrest_isIn: ${endTime - startTime} ms`)
}

function isIn_matches_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let matcher = IsIn.isIn(arr) 
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches("Thomas")                                                                
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_isIn_matches error')
    }
    print(`hamcrest_isIn_matches: ${endTime - startTime} ms`)
}

/**
 * Every
 * everyItem
 */
function everyItem_Test() {
    let contains = StringContains.containsString('a')
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = Every.everyItem(contains)                                                                
    }
    let endTime = getDate()
    let arr = ["alice", "Charlie", "David", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Ryan", "Sophia", "Thomas","Quinn"]
    let result = matcher.matches(arr)  
    if (result !== false) {
        throw new Error('hamcrest_everyItem error')
    }
    print(`hamcrest_everyItem: ${endTime - startTime} ms`)
}

function everyItem_matches_Test() {
    let contains = StringContains.containsString('a')
    let matcher = Every.everyItem(contains)
    let arr = ["alice", "Charlie", "David", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Ryan", "Sophia", "Thomas"]
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(arr)                                                           
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_everyItem_matches error')
    }
    print(`hamcrest_everyItem_matches: ${endTime - startTime} ms`)
}

/**
 * MatchesPattern
 * matchesPattern
*/
function matchesPattern_Test() {
    let matcher
    let regex = new RegExp('^Every morning')
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = MatchesPattern.matchesPattern(regex)                                                                
    }
    let endTime = getDate()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== true) {
        throw new Error('hamcrest_matchesPattern error')
    }
    print(`hamcrest_matchesPattern: ${endTime - startTime} ms`)
}

function matchesPattern_matches_Test() {
    let regex = new RegExp('^Every morning')
    let matcher = MatchesPattern.matchesPattern(regex)
    let str = "every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)                                                           
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_matchesPattern_matches error')
    }
    print(`hamcrest_matchesPattern_matches: ${endTime - startTime} ms`)
}

/**
 * MatchesPattern
 * matchesStringPattern
*/
function matchesStringPattern_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        matcher =  MatchesPattern.matchesStringPattern("^Every morning")                                                             
    }
    let endTime = getDate()
    let str = "every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str)
    if (result !== false) {
        throw new Error('hamcrest_matchesStringPattern error')
    }
    print(`hamcrest_matchesStringPattern: ${endTime - startTime} ms`)
}

function matchesStringPattern_matches_Test() {
    let matcher =  MatchesPattern.matchesStringPattern("^Every morning")
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)                                                                   
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_matchesStringPattern_matches error')
    }
    print(`hamcrest_matchesStringPattern_matches: ${endTime - startTime} ms`)
}


/**
 * IsEqualCompressingWhiteSpace
 * equalToCompressingWhiteSpace
 */
function equalToCompressingWhiteSpace_Test() {
    let str = 'EveryMorning,shewalksthroughthequietpark,enjoying the serene beauty of nature as the sun rises.'
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace(str)                                                                  
    }
    let endTime = getDate()
    let str1 = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str1)
    if (result !== false) {
        throw new Error('hamcrest_equalToCompressingWhiteSpace error')
    }
    print(`hamcrest_equalToCompressingWhiteSpace: ${endTime - startTime} ms`)
}

function equalToCompressingWhiteSpace_matches_Test() {
    let str = 'Everymorning,shewalksthroughthequietpark,enjoying the serene beauty of nature as the sun rises.'
    let matcher = IsEqualCompressingWhiteSpace.equalToCompressingWhiteSpace(str)
    let str1 = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str1)                                                              
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_equalToCompressingWhiteSpace_matches error')
    }
    print(`hamcrest_equalToCompressingWhiteSpace_matches: ${endTime - startTime} ms`)
}

/**
 * IsEqualCompressingWhiteSpace
 * equalToIgnoringWhiteSpace
 */
function equalToIgnoringWhiteSpace_Test() {
    let str = 'EveryMorning,shewalksthroughthequietpark,enjoying the serene beauty of nature as the sun rises.'
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEqualCompressingWhiteSpace.equalToIgnoringWhiteSpace(str)                                                                  
    }
    let endTime = getDate()
    let str1 = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result = matcher.matches(str1)
    if (result !== false) {
        throw new Error('hamcrest_equalToIgnoringWhiteSpace error')
    }
    print(`hamcrest_equalToIgnoringWhiteSpace: ${endTime - startTime} ms`)
}

function equalToIgnoringWhiteSpace_matches_Test() {
    let str = 'Everymorning,shewalksthroughthequietpark,enjoying the serene beauty of nature as the sun rises.'
    let matcher = IsEqualCompressingWhiteSpace.equalToIgnoringWhiteSpace(str)
    let str1 = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(str1)                                                              
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_equalToIgnoringWhiteSpace_matches error')
    }
    print(`hamcrest_equalToIgnoringWhiteSpace_matches: ${endTime - startTime} ms`)
}

/**
 * IsSame
 * sameInstance
*/
function sameInstance_Test() {
    let stu1 = new Student('joe',12, 3, 1)
    let stu2 = new Student('joe',12, 3, 1)
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsSame.sameInstance(stu1)                                                                 
    }
    let endTime = getDate()
    let result =  matcher.matches(stu2)
    if (result !== false) {
        throw new Error('hamcrest_sameInstance error')
    }
    print(`hamcrest_sameInstance: ${endTime - startTime} ms`)
}

function sameInstance_matches_Test() {
    let stu1 = new Student('joe',12, 3, 1)
    let matcher = IsSame.sameInstance(stu1)
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {    
        result =  matcher.matches(stu1)                                                            
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_sameInstance_matches error')
    }
    print(`hamcrest_sameInstance_matches: ${endTime - startTime} ms`)
}


/**
 * IsSame
 * theInstance
*/
function theInstance_Test() {
    let stu1 = new Student('joe',12, 3, 1)
    let stu2 = new Student('joe',12, 3, 1)
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsSame.theInstance(stu1)                                                                 
    }
    let endTime = getDate()
    let result =  matcher.matches(stu2)
    if (result !== false) {
        throw new Error('hamcrest_theInstance error')
    }
    print(`hamcrest_theInstance: ${endTime - startTime} ms`)
}

function theInstance_matches_Test() {
    let stu1 = new Student('joe',12, 3, 1)
    let matcher = IsSame.theInstance(stu1)
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {    
        result =  matcher.matches(stu1)                                                            
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_theInstance_matches error')
    }
    print(`hamcrest_theInstance_matches: ${endTime - startTime} ms`)
}


/**
 * IsIterableContaining
 * hasItem
*/


function hasItem_Test() {
    let matcher
    let contains = StringContains.containsString('saa')
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {    
        matcher = IsIterableContaining.hasItem(contains)                                                          
    }
    let endTime = getDate()
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result = matcher.matches(arr)  
    if (result !== true) {
        throw new Error('hamcrest_hasItem error')
    }
    print(`hamcrest_hasItem: ${endTime - startTime} ms`)
}

function hasItem_matches_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let matcher = IsIterableContaining.hasItem(StringContains.containsString('saa'))
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {    
        result = matcher.matches(arr)                                                        
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_hasItem_matches error')
    }
    print(`hamcrest_hasItem_matches: ${endTime - startTime} ms`)
}

/**
 * IsIterableContaining
 * hasTargetItem
*/

function hasTargetItem_Test(){
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {    
        matcher = IsIterableContaining.hasTargetItem('saa')                                                         
    }
    let endTime = getDate()
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result = matcher.matches(arr)  
    if (result !== false) {
        throw new Error('hamcrest_hasTargetItem error')
    }
    print(`hamcrest_hasTargetItem: ${endTime - startTime} ms`)
}

function hasTargetItem_matches_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let matcher = IsIterableContaining.hasTargetItem('Sophia') 
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {    
        result = matcher.matches(arr)                                                    
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_hasTargetItem_matches error')
    }
    print(`hamcrest_hasTargetItem_matches: ${endTime - startTime} ms`)
}

/**
 * IsEmptyString
 * emptyString
*/
function emptyString_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEmptyString.emptyString()                                                   
    }
    let endTime = getDate()
    let result = matcher.matches('')
    if (result !== true) {
        throw new Error('hamcrest_emptyString error')
    }
    print(`hamcrest_emptyString: ${endTime - startTime} ms`)
}

function emptyString_matches_Test() {
    let matcher = IsEmptyString.emptyString() 
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)                                                  
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_emptyString_matches error')
    }
    print(`hamcrest_emptyString_matches: ${endTime - startTime} ms`)
}


/**
 * IsEmptyString
 * emptyOrNullString
 */

function emptyOrNullString_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsEmptyString.emptyOrNullString()                                                    
    }
    let endTime = getDate()
    let result = matcher.matches(null)
    if (result !== true) {
        throw new Error('hamcrest_emptyOrNullString error')
    }
    print(`hamcrest_emptyOrNullString: ${endTime - startTime} ms`)
}

function emptyOrNullString_matches_Test() {
    let matcher = IsEmptyString.emptyOrNullString()
    let str = "Every morning, she walks through the quiet park, enjoying the serene beauty of nature as the sun rises."
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(str)                                                    
    }
    let endTime = getDate()
    if (result !== false) {
        throw new Error('hamcrest_emptyOrNullString_matches error')
    }
    print(`hamcrest_emptyOrNullString_matches: ${endTime - startTime} ms`)
}

/**
 * ArrayMatching
 * hasItemInArrayMatcher
*/
function hasItemInArrayMatcher_Test() {
    let contains = StringContains.containsString("Jac")
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = ArrayMatching.hasItemInArrayMatcher(contains)                                                
    }
    let endTime = getDate()
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result = matcher.matches(arr)
    if (result !== false) {
        throw new Error('hamcrest_hasItemInArrayMatcher error')
    }
    print(`hamcrest_hasItemInArrayMatcher: ${endTime - startTime} ms`)
}

function hasItemInArrayMatcher_matches_Test() {
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let contains = StringContains.containsString("Jack")
    let matcher = ArrayMatching.hasItemInArrayMatcher(contains)
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount_short; i++) {
        result = matcher.matches(arr)                                                
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_hasItemInArrayMatcher_matches error')
    }
    print(`hamcrest_hasItemInArrayMatcher_matches: ${endTime - startTime} ms`)
}


/**
 * IsAnything
 * anything
*/

function anything_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsAnything.anything()                                                 
    }
    let endTime = getDate()
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result = matcher.matches(arr)
    if (result !== true) {
        throw new Error('hamcrest_anything error')
    }
    print(`hamcrest_anything: ${endTime - startTime} ms`)
}

function anything_matches_Test() {
    let matcher = IsAnything.anything() 
    let arr = ["Alice", "Bob", "Charlie", "David", "Emily", "Frank", "Grace", "Hannah", "Isaac", "Jack", "Katie", "Liam", "Mia", "Nathan", "Olivia", "Peter", "Quinn", "Ryan", "Sophia", "Thomas"]
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(arr)                                             
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_anything_matches error')
    }
    print(`hamcrest_anything_matches: ${endTime - startTime} ms`)
}


/**
 * IsInstanceOf
 * instanceOf
 */

function instanceOf_Test() {
    let matcher
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        matcher = IsInstanceOf.instanceOf(Student)                                                 
    }
    let endTime = getDate()
    let stu = new Student()
    let result = matcher.matches(stu)
    if (result !== true) {
        throw new Error('hamcrest_instanceOf error')
    }
    print(`hamcrest_instanceOf: ${endTime - startTime} ms`)
}

function instanceOf_matches_Test() {
    let stu = new Student()
    let matcher = IsInstanceOf.instanceOf(Student) 
    let result
    let startTime = getDate()
    for (let i = 0; i < runCount; i++) {
        result = matcher.matches(stu)                                               
    }
    let endTime = getDate()
    if (result !== true) {
        throw new Error('hamcrest_instanceOf_matches error')
    }
    print(`hamcrest_instanceOf_matches: ${endTime - startTime} ms`)
}

function getDate() {
    return Date.now()
}

function runAllTest() {
    hasProperty_Test()
    hasProperty_Matches_Test()
    hasLength_Test()
    hasLength_Matches_Test()
    anyOf_Test()
    anyOf_Matches_Test()
    anyOfMatches_Test()
    anyOfMatches_Matches_Test()
    containsString_Test()
    containsString_matches_Test()
    containsStringIgnoringCase_Test()
    containsStringIgnoringCase_matches_Test()
    allOf_Test()
    allOf_matches_Test()
    allOfMatches_Test()
    allOfMatches_matches_Test()
    notANumber_Test()
    notANumber_matches_Test()
    equalTo_Test()
    equalTo_matches_Test()
    equalToIgnoringCase_Test()
    equalToIgnoringCase_matches_Test()
    greaterThan_Test()
    greaterThan_matches_Test()
    greaterThanOrEqualTo_Test()
    greaterThanOrEqualTo_matches_Test()
    lessThan_Test()
    lessThan_matches_Test()
    lessThanOrEqualTo_Test()
    lessThanOrEqualTo_matches_Test()
    comparesEqualTo_Test()
    comparesEqualTo_matches_Test()
    blankString_Test()
    blankString_matches_Test()
    blankOrNullString_Test()
    blankOrNullString_matches_Test()
    closeTo_Test()
    closeTo_matches_Test()
    nullValue_Test()
    nullValue_matches_Test()
    notNullValue_Test()
    notNullValue_matches_Test()
    not_Test()
    not_matches_Test()
    is_Test()
    is_matches_Test()
    startsWith_Test()
    startsWith_matches_Test()
    startsWithIgnoringCase_Test()
    startsWithIgnoringCase_matches_Test()
    endsWith_Test()
    endsWith_matches_Test()
    endsWithIgnoringCase_Test()
    endsWithIgnoringCase_matches_Test()
    array_Test()
    array_matches_Test()
    isIn_Test()
    isIn_matches_Test()
    everyItem_Test()
    everyItem_matches_Test()
    matchesPattern_Test()
    matchesPattern_matches_Test()
    matchesStringPattern_Test()
    matchesStringPattern_matches_Test()
    equalToCompressingWhiteSpace_Test()
    equalToCompressingWhiteSpace_matches_Test()
    equalToIgnoringWhiteSpace_Test()
    equalToIgnoringWhiteSpace_matches_Test()
    sameInstance_Test()
    sameInstance_matches_Test()
    theInstance_Test()
    theInstance_matches_Test()
    hasItem_Test()
    hasItem_matches_Test()
    hasTargetItem_Test()
    hasTargetItem_matches_Test()
    emptyString_Test()
    emptyString_matches_Test()
    emptyOrNullString_Test()
    emptyOrNullString_matches_Test()
    hasItemInArrayMatcher_Test()
    hasItemInArrayMatcher_matches_Test()
    anything_Test()
    anything_matches_Test()
    instanceOf_Test()
    instanceOf_matches_Test()
}
let loopCountForPreheat = 1;
for (let i = 0; i < loopCountForPreheat; i++) {
    runAllTest()
}

ArkTools.waitAllJitCompileFinish();

runAllTest()

